package com.cn.icss.validator;

import com.alibaba.fastjson.JSON;
import com.cn.icss.vo.common.ResponseCode;
import com.cn.icss.vo.common.ResponseResult;
import com.cn.icss.vo.common.ResponseStatus;
import com.jfinal.core.Controller;
import com.jfinal.kit.Ret;
import com.jfinal.validate.Validator;

import java.util.Map;

/**
 * @中软华腾软件系统有限公司,未经授权不得擅自传播
 * @类描述:
 * @类名称:StreamValidator
 * @作者: Administrator
 * @编辑时间: 2020/04/08 19:12
 * @版本: 1.0
 */
public class StreamValidator extends BaseValidator {

    @Override
    protected void validate(Controller c) {
        setRet(Ret.fail());// 官网推荐
        // 判断写各个方法的验证
        switch (super.getActionMethodName()) {

            case "index": {
                super.validateRequired("id", "message", "id不能为空");
                break;
            }
            case "findBaseStreamInfo":
            case "findStreamInfo": {
                super.validateRequired("streamId", "streamId_message", "streamId不能为空");
                break;
            }
            case "findStreamAddr": {
                super.validateRequired("streamId", "streamId_message", "streamId不能为空");
//                super.validateRequired("tokenId", "tokenId_message", "tokenId不能为空");
                break;
            }
            case "createStream": {
                super.validateRequired("roomTypeId", "roomTypeId_message", "直播间类型不能为空");
//                super.validateRequired("dicId", "dicId_message", "创建人身份证或者电话号码不能为空");
                super.validateRequired("dicId", "dicId_message", "注册平台Id非空");
//                super.validateRequired("tokenId", "tokenId_message", "tokenId不能为空");
                break;
            }
            case "updateStream":{
                super.validateRequired("roomTypeId", "roomTypeId_message", "直播间类型不能为空");
                super.validateRequired("dicId", "dicId_message", "创建人身份证或者电话号码不能为空");
                super.validateRequired("streamId", "streamId_message", "streamId不能为空");
            }
            default: {

            }

        }

    }

}
